<html>
<head><meta charset="utf-8"><title>Replace hir replaced by graph · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Replace.20hir.20replaced.20by.20graph.html">Replace hir replaced by graph</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="216061250"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Replace%20hir%20replaced%20by%20graph/near/216061250" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mr Smeet <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Replace.20hir.20replaced.20by.20graph.html#216061250">(Nov 09 2020 at 09:43)</a>:</h4>
<p>How do you look at to remove the hir and replace it with a graph database or own  graph implementation with query language?</p>



<a name="216061916"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Replace%20hir%20replaced%20by%20graph/near/216061916" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Replace.20hir.20replaced.20by.20graph.html#216061916">(Nov 09 2020 at 09:50)</a>:</h4>
<p>Depends on which level of hir we are talking about. </p>
<p>For the public API visible to the client of rust-analyzer (<code>code_model.rs</code>), it should be pretty straight-forward to add additional access methods (albeit this still requires a ton of  work, the API is not small).</p>
<p>For the implementation of rust-analyzer, I don't know -- I guess, this means rewrting salsa to be based on graph data model, which sounds like research problem.</p>



<a name="216062303"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Replace%20hir%20replaced%20by%20graph/near/216062303" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mr Smeet <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Replace.20hir.20replaced.20by.20graph.html#216062303">(Nov 09 2020 at 09:54)</a>:</h4>
<p>I want to understand in general whether such a patch will be considered?</p>



<a name="216062911"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Replace%20hir%20replaced%20by%20graph/near/216062911" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> matklad <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Replace.20hir.20replaced.20by.20graph.html#216062911">(Nov 09 2020 at 10:01)</a>:</h4>
<p>It definitely would be an interesting approach to look at. It is true that the current code_model API is pretty unprincipled. Something with he <a href="http://www.stroustrup.com/gdr-bs-macis09.pdf">http://www.stroustrup.com/gdr-bs-macis09.pdf</a> level of scholarship would be much appreciated. </p>
<p>But, with my baseline understanding of problem space, I'd estimate the probability of success for graph db approach specifically to be pretty low -- maybe an order of magnitude lower than for traditional OO style code model tries to follow now.</p>
<p>So, it's unlikely that we'll accept an incomplete version in-true for the purposes of experimentation (as P of success doesn't outweigh maintenance cost), but we obviously won't be able to say now if a sufficiently complete thing exists and proves to be better than the current approach.</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>